package com.ldap.core.util;

import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;

import org.springframework.ldap.core.AttributesMapper;

import com.ldap.core.bean.SystemSetting;

/**
 * ClassName: SystemSettingAttributesMapper 
 * @Description: TODO
 * @author chenshufeng
 * @date 2017-2-9
 */
public class SystemSettingAttributesMapper implements AttributesMapper<SystemSetting> {

	@Override
	public SystemSetting mapFromAttributes(Attributes attributes)
			throws NamingException {
		SystemSetting systemSetting = new SystemSetting();
        Attribute name = attributes.get("systemSettingName");
        Attribute value = attributes.get("systemSettingValue");
        Attribute commet = attributes.get("systemSettingCommet");
        Attribute htmlInfo = attributes.get("systemSettingHtmlInfo");
        systemSetting.setName(String.valueOf(name));
        systemSetting.setValue(String.valueOf(value));
        systemSetting.setCommet(String.valueOf(commet));
        systemSetting.setHtmlInfo(String.valueOf(htmlInfo));
        return systemSetting;
	}

}